package com.ruoyi.wechat.api;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wechat.domain.Dynamic;
import com.ruoyi.wechat.service.IDynamicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wechat/dynamic")
public class WxDynamicController extends BaseController {

    @Autowired
    private IDynamicService dynamicService;

    /**
     * 查询dynamic列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Dynamic dynamic)
    {
        List<Dynamic> list = dynamicService.selectDynamicAndImageList(dynamic);
        return getDataTable(list);
    }

    @PostMapping
    public AjaxResult add(@RequestBody Dynamic dynamic)
    {
        return toAjax(dynamicService.insertDynamic(dynamic));
    }

}
